package BookManagement.service;

import BookManagement.dao.BookDao;
import BookManagement.domain.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service("bookService")
public class BookServiceImpl implements BookService{

    @Autowired
    private BookDao bookDao;

    @Override
    public Book findByISBN(String ISBN) {
        return bookDao.findByISBN(ISBN);
    }

    @Override
    public int getTotalBooks() {
        return bookDao.getTotalBooks();
    }

    @Override
    public int getTotalBooksBy(String str){
        return bookDao.getTotalBooksBy(str);
    }
    @Override
    public List<Book> findAllBooks(HashMap<String, Object> map) {
        return bookDao.findAllBooks(map);
    }

    @Override
    public List<Book> findByBookNameOrAuthor(HashMap<String,Object> map){return bookDao.findByBookNameOrAuthor(map);}

    @Override
    public int addBook(Book b) {
        return bookDao.addBook(b);
    }

    @Override
    public int deleteBookByISBN(String ISBN) {
        return bookDao.deleteBookByISBN(ISBN);
    }

    @Override
    public int updateBook(Book b) {
        return bookDao.updateBook(b);
    }

    @Override
    public int updateBookCounts(HashMap<String,Object> map){return bookDao.updateBookCounts(map);}

}
